* Stata do-file, Robustness tests for Chapter 2, Mark R. Beissinger, 
*    The Revolutionary City  
version 14
clear all
set more off
log using Robustnesstestfiles\Logfiles\robustnesstestschapter2.log, replace
* ============================================================================
* ROBUSTNESS CHECKS FOR STATISTICAL RESULTS APPEARING IN CHAPTER 2
* Stata do-file  
* Robustness tests for results reported in Chapter 2  
* Author: Mark R. Beissinger  
* Date:  January 2022  
* Princeton, NJ 
* ============================================================================
* BEFORE RUNNING, YOU MUST SET THE DEFAULT PATH FOR WHERE THE DATA
*   FILES RESIDE
* ============================================================================
* The following datafile used in Chapter 2 was used in these tests:
*     Panel data for revolutionary episodes--revspredictbycntryyr.dta
* ============================================================================
* Before running, ensure the following packages for Stata are downloaded:
* 	firthlogit from http://fmwww.bc.edu/RePEc/bocode/f
* 	relogit from https://gking.harvard.edu/relogit
* ============================================================================
* The following output is produced from these robustness tests:
*		Robustnesstestfiles\Logfiles\robustnesstestschapter2.log
* ============================================================================

* =============================================================
* ROBUSTNESS CHECKS:  LAND CONCENTRATION IN SOCIAL REVOLUTIONS
* =============================================================
clear
use revspredictbycntryyr.dta
xtcloglog leftistny landgini c.time1##c.time1##c.time1, vce(robust) eform nolog
* Positive and statistically significant,
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01 

* Different estimation frameworks
* Pooled sample
cloglog leftistny landgini time1 timesq timecub, vce(cluster cowcode) nolog eform
* Positive and statistically significant
* Rare events framework
relogit leftistny landgini time1 timesq timecub, cluster(cowcode) pc(.0081)
* Note: pc parameter set to proportion of positive leftistny in sample analyzed (.0081)
* Positive and statistically significant
* Robustness tests: Firth method
firthlogit leftistny landgini time1 timesq timecub, or nolog
* Positive and statistically significant
* Robustness tests:  population averaged model with AR 1
xtcloglog leftistny landgini time1 timesq timecub, pa corr(ar 1) force vce(robust) nolog eform
* Positive and statistically significant

* OTHER REVOLUTIONS
* All rural revolutions
xtcloglog ruralrevny landgini c.time1##c.time1##c.time1, vce(robust) eform nolog
* Positive but statistically insignificant
quadchk, nooutput
* --Passed:  all coefficients change by less than .01 

* All urban revolutions
xtcloglog urbanrevny landgini c.time1##c.time1##c.time1, vce(robust) eform nolog
* Positive but statistically insignificant
quadchk, nooutput
* --Passed:  all coefficients change by less than .01 

* All urban civic revolutions
xtcloglog urbancivicny landgini c.time1##c.time1##c.time1, vce(robust) eform nolog
* Negative and statistically significant
quadchk, nooutput
* --Passed:  all coefficients change by less than .01 

* =============================================================
* ROBUSTNESS CHECKS:  RAPID POPULATION GROWTH AND YOUTH BULGES 
*   IN REVOLUTIONARY EPISODES
* =============================================================
* POST-COLD WAR PERIOD (1985-2014) VS. 1900-84 PERIOD
* Aged 15-24
xtcloglog revny  i.postcoldwar##c.youthpercl time1 timesq timecub, vce(robust) nolog eform
* Interaction is statistically significant, with postcoldwar being negative and 
*   before the post-Cold War era being positive
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01 
*  Aged 15-24, controlling for population size, level of development, and economic growth
* Model with controls
xtcloglog revny lnpopl gdppcthl gdppcgrow1yrl i.postcoldwar##c.youthpercl time1 timesq timecub, vce(robust) nolog eform
* Interactions are statistically significant, with postcoldwar being negative and 
*   1900-1984 being positive; 1900-1984 interaction was significant at the
* 	.10 level only
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01 
* DIFFERENT ESTIMATION FRAMEWORKS
* Pooled
cloglog revny lnpopl gdppcthl gdppcgrow1yrl i.postcoldwar##c.youthpercl time1 timesq timecub, vce(cluster cowcode) nolog eform
* Interactions are statistically significant, with postcoldwar being negative and 
*   1900-1984 being positive; 1900-1984 interaction was significant at the
* 	.10 level only
* Rare events
* Note: pc parameter set to proportion of positive revny in sample analyzed (.0218)
generate postxyouthpercl = postcoldwar * youthpercl
relogit revny lnpopl gdppcthl gdppcgrow1yrl postcoldwar youthpercl postxyouthpercl time1 timesq timecub, cluster(cowcode) pc(.0218)
* Interactions are statistically significant, with postcoldwar being negative and 
*   1900-1984 being positive; 1900-1984 interaction was significant at the
* 	.10 level only
* Firth method
* Note: DOES NOT CONVERGE (likely due to multicollinearity--converges when timecub variable is dropped)
firthlogit revny lnpopl gdppcthl gdppcgrow1yrl postcoldwar youthpercl postxyouthpercl time1 timesq, or nolog
* 1900-1984 interaction was positive but not significant; postcoldwar interaction was negative and 
*   statistically signficant

*  Youth bulges, as measured by populaton aged 0-15
xtcloglog revny i.postcoldwar##c.percunder15l time1 timesq timecub, vce(robust) nolog eform
* Post-cold war period is negative but statistically insignificant; 1900-1984 
* 	interaction is positive and statistically insignificant
quadchk, nooutput
* --Passed:  all coefficients change by less than .01 
*  Aged 0-15, controlling for population size, level of development, and economic growth
xtcloglog revny lnpopl gdppcthl gdppcgrow1yrl i.postcoldwar##c.percunder15l time1 timesq timecub, vce(robust) nolog eform
* 1900-1984 interaction was positive but not significant; postcoldwar interaction was negative and 
*   statistically signficant
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01
* DIFFERENT ESTIMATION FRAMEWORKS
* Pooled
cloglog revny lnpopl gdppcthl gdppcgrow1yrl i.postcoldwar##c.percunder15l time1 timesq timecub, vce(cluster cowcode) nolog eform
* 1900-1984 interaction was positive but not significant; postcoldwar interaction was negative and 
*   statistically signficant
* Rare events
* Note: pc parameter set to proportion of positive revny in sample analyzed (.0215)
generate postxyouthund15l = postcoldwar * youthpercl
relogit revny lnpopl gdppcthl gdppcgrow1yrl postcoldwar percunder15l postxyouthund15l time1 timesq timecub, cluster(cowcode) pc(.0215)
* 1900-1984 interaction was positive but not significant; postcoldwar interaction was negative and 
*   statistically signficant
* Firth method
* Note: DOES NOT CONVERGE (likely due to multicollinearity--converges when timecub variable is dropped)
firthlogit revny lnpopl gdppcthl gdppcgrow1yrl postcoldwar percunder15l postxyouthund15l time1 timesq, or nolog
* 1900-1984 interaction was positive but not significant; postcoldwar interaction was negative and 
*   statistically signficant
drop postxyouthpercl postxyouthund15l

* RURAL VS. URBAN REVS
* Rural revs
xtcloglog ruralrevny lnpopl youthpercl time1 timesq timecub, vce(robust) nolog eform
* --youthpercl is positive and statistically significant
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01 
* Urban revs
xtcloglog urbanrevny lnpopl youthpercl time1 timesq timecub, vce(robust) nolog eform
* youthpercl is negative and statistically insignificant
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01 

* ======================================================================
* ROBUSTNESS CHECKS:  URBANIZATION MAKING URBAN REVOLTS MORE LIKELY AND 
*    RURAL REVOLTS LESS LIKELY
* ======================================================================
* Urban revolts
xtcloglog urbanrevny lnpopl gdppcthl polityl polityl2 percurbanl time1 timesq timecub, vce(robust) nolog eform
* percurbanl is positive and statistically significant
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01 
* Different estimation frameworks
* Pooled sample
cloglog urbanrevny lnpopl gdppcthl polityl polityl2 percurbanl time1 timesq timecub, vce(cluster cowcode) nolog eform
* percurbanl is positive and statistically significant
* Rare events framework
* Note: pc parameter set to proportion of positive urbanrevny in sample analyzed (.0136)
relogit urbanrevny lnpopl gdppcthl  polityl polityl2 percurbanl time1 timesq timecub, cluster(cowcode) pc(.0136)
* percurbanl is positive and statistically significant
* Firth method
firthlogit urbanrevny lnpopl gdppcthl polityl polityl2 percurbanl time1 timesq timecub, or nolog
* percurbanl is positive and statistically significant

* Rural revolts
xtcloglog ruralrevny lnpopl gdppcthl polityl polityl2 percurbanl time1 timesq timecub, vce(robust) nolog eform
* percurbanl is negative and statistically significant
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01 
* Different estimation frameworks
* Pooled sample
cloglog ruralrevny lnpopl gdppcthl polityl polityl2 percurbanl time1 timesq timecub, vce(cluster cowcode) nolog eform
* percurbanl is negative and statistically significant 
* Rare events framework
relogit ruralrevny lnpopl gdppcthl polityl polityl2 percurbanl time1 timesq timecub, cluster(cowcode) pc(.0098)
* Note: pc parameter set at proportion of positive ruralrevny in sample utilized (.0098)
* percurbanl is negative and statistically significant 
* Firth method
firthlogit ruralrevny lnpopl gdppcthl polityl polityl2 percurbanl time1 timesq timecub, or nolog
* percurbanl is negative and statistically significant 

* ==========================================================================
* ROBUSTNESS CHECKS: RELATIONSHIP OF URBAN/RURAL TO TIME SINCE INDEPENDENCE
* ==========================================================================
* Urban revolutions
xtcloglog ruralrevny lnyrsindependent time1 timesq timecub, nolog eform vce(robust)
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01 
* Rural revolutions
xtcloglog urbanrevny lnyrsindependent time1 timesq timecub, nolog eform vce(robust)
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01 

* =======================================================================
* ROBUSTNESS CHECKS: RELATIONSHIP OF URBAN/RURAL TO EFFECTIVE TERRITORIAL 
* 	CONTROL OF STATES
* =======================================================================
* Rural revolutions
xtcloglog ruralrevny v2svstterr time1 timesq timecub, nolog eform vce(robust)
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01 
* Urban revolutions
xtcloglog urbanrevny v2svstterr time1 timesq timecub, nolog eform vce(robust)
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01 

* ===========================================================================
* ROBUSTNESS CHECKS: COUNTRY EXTERNAL BATTLE DEATHS AND ONSET OF REVOLUTIONS
* ===========================================================================
* Social
xtcloglog leftistny lnextwardeathsl time1 timesq timecub if colony==0, vce(robust) eform nolog
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01
* Constitutional/anti-monarchical
xtcloglog antimonarchny lnextwardeathsl time1 timesq timecub if colony==0, vce(robust) eform nolog
* Quadrature test
quadchk, nooutput
* Failed--using 16 integration points below
xtcloglog antimonarchny lnextwardeathsl time1 timesq timecub if colony==0, vce(robust) eform nolog intpoints(16)
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01
* Urban civic
xtcloglog urbancivicny lnextwardeathsl time1 timesq timecub if colony==0, vce(robust) eform nolog
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01
* Independence
xtcloglog independny lnextwardeathsl  time1 timesq timecub , vce(robust) eform nolog
* Quadrature test
quadchk, nooutput
* Failed--using 16 integration points below
xtcloglog independny lnextwardeathsl  time1 timesq timecub , vce(robust) eform nolog intpoints(16)
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01
* Ethnic hierarchy
xtcloglog ethnicorderny lnextwardeathsl time1 timesq timecub if colony==0, vce(robust) eform nolog
* Quadrature test
quadchk, nooutput
* Failed--using 16 integration points below
xtcloglog ethnicorderny lnextwardeathsl time1 timesq timecub if colony==0, vce(robust) eform nolog intpoints(16)
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01

* =========================================================================
* ROBUSTNESS CHECKS: FINANCIAL CRISIS AND ONSET OF URBAN CIVIC REVOLUTIONS
* =========================================================================
xtcloglog urbancivicny rrfinstressl time1 timesq timecub if colony==0, vce(robust) eform nolog
* Quadrature test
quadchk, nooutput
* --Passed:  all coefficients change by less than .01 


log close

clear
